{% comment %}
<!--
  Copyright (C) 2008 ZHENG Zhong <http://www.zhengzhong.net/>

  Created on 2009-04-30.
  $Id$
-->
{% endcomment %}

<div id="overview" class="ajax_box">

  <!-- main _____________________________________________________________________________________-->
  
  <div class="main">
  
    <div class="title">
      <h1>{{movie.name|escape}}</h1>
    </div><!--/.title-->
    
    <div class="submitter">
      Added on {{movie.submit_date|date:"Y-m-d"}} by
      <a href="{{webapp_}}/user/{{movie.submitter.user_id}}/">
        {{movie.submitter.nickname|escape}}
      </a>
    </div><!--/.submitter-->
    
    {% include "hottywood/ajax/ajax_error.html" %}
  
  </div><!--/.main-->
  
  <!-- container ________________________________________________________________________________-->
  
  <div class="container">
  
    <!-- poster _________________________________________________________________________________-->
    
    <div class="poster">
      {% if movie.has_poster %}
        <img src="{{webapp_}}/movie/{{movie.key.id}}/poster/"
             alt="{{movie.name|escape}}"
             title="{{movie.name|escape}}"/>
      {% else %}
        <img src="{{static_}}/images/movie_no_poster.jpg"
             alt="{{movie.name|escape}} (no poster)"
             title="{{movie.name|escape}} (no poster)"/>
      {% endif %}
    </div><!--/.poster-->
    
    <!-- information ____________________________________________________________________________-->
    
    <div class="information">
    
      <!-- view _________________________________________________________________________________-->
      
      <div class="view">
      
        <table>
          <tbody>
            <tr>
              <th style="width:1%;">
                <span class="nowrap">
                  <img src="{{static_}}/images/run_time_icon.gif" alt="Run time"/> &nbsp;
                  Run time :
                </span>
              </th>
              <td>
                <span class="nowrap">{{movie.run_time}} minutes</span>
              </td>
            </tr>
            <tr>
              <th style="width:1%;">
                <span class="nowrap">
                  <img src="{{static_}}/images/hot_time_icon.gif" alt="Hot time"/> &nbsp;
                  Hot time :
                </span>
              </th>
              <td>
                <span class="nowrap">
                  {{movie.hot_seconds}} seconds (in {{movie.hot_scenes}} hot scenes)
                </span>
              </td>
            </tr>
            <tr>
              <th style="width:1%;">
                <span class="nowrap">
                  <img src="{{static_}}/images/hot_ratio_icon.gif" alt="Hot ratio"/> &nbsp;
                  Hot ratio :
                </span>
              </th>
              <td>
                <span class="nowrap">
                  {{movie.hot_ratio_per_mille}}&permil;
                </span>
              </td>
            </tr>
            <tr>
              <th style="width:1%;">
                <span class="nowrap">
                  <img src="{{static_}}/images/imdb_icon.gif" alt="IMDb link"/> &nbsp;
                  IMDb link :
                </span>
              </th>
              <td>
                <span class="nowrap">
                  <a href="http://www.imdb.com/title/{{movie.imdb_id}}/">{{movie.imdb_id}}</a>
                </span>
              </td>
            </tr>
            <tr>
              <td colspan="2">
                {% if movie.description %}
                  <div>{{movie.description|escape|linebreaks}}</div>
                {% else %}
                  <div class="na">This movie does not have a description.</div>
                {% endif %}
              </td>
            </tr>
          </tbody>
        </table>
      
        {% if is_admin_ %}
          <div class="toggle_link">
            <a href="javascript:void(0);" onclick="toggleBox('#overview');">
              [edit movie information]
            </a>
          </div>
        {% endif %}
      
      </div><!--/.view-->
    
      <!-- edit ___________________________________________________________________________________-->
      
      {% if is_admin_ %}
      
        <div id="edit_tabs" class="edit hidden tabs">
        
          <div class="tab_toggles">
            <a class="tab_toggle selected"
               href="#edit_basic_info_form"
               onclick="return switchTab('#edit_tabs', '#edit_basic_info_form');">
              Basic information
            </a>
            <a class="tab_toggle"
               href="#upload_poster_form"
               onclick="return switchTab('#edit_tabs', '#upload_poster_form');">
              Movie poster
            </a>
          </div><!--/.tab_toggles-->
          
          <div class="tab_panels">
          
            <form id="edit_basic_info_form" class="small form" action="." method="POST"
                  onsubmit="return submitAjaxForm('#overview', '#edit_basic_info_form');">
              <input type="hidden" name="ajax_box" value="overview"/>
              <table>
                <tbody>
                  <tr>
                    <th style="width:1%;"><span class="nowrap">Movie name :</span></th>
                    <td><input type="text" name="name" value="{{movie.name|escape}}"/></td>
                  </tr>
                  <tr>
                    <th style="width:1%;"><span class="nowrap">ABC :</span></th>
                    <td><input type="text" name="abc" value='{{movie.abc|join:","}}'/></td>
                  </tr>
                  <tr>
                    <th style="width:1%;"><span class="nowrap">IMDb ID :</span></th>
                    <td><input type="text" name="imdb_id" value="{{movie.imdb_id}}"/></td>
                  </tr>
                  <tr>
                    <th style="width:1%;"><span class="nowrap">Run time :</span></th>
                    <td><input type="text" name="run_time" value="{{movie.run_time}}"/></td>
                  </tr>
                  <tr>
                    <th style="width:1%;"><span class="nowrap">Description :</span></th>
                    <td><textarea name="description">{{movie.description|default:""|escape}}</textarea></td>
                  </tr>
                  <tr>
                    <th style="width:1%;"></th>
                    <td>
                      <input class="button" type="submit" value="Update"/>
                      <input class="button" type="button" onclick="toggleBox('#overview');" value="Cancel"/>
                      <span class="ajax_indicator hidden">
                        <img src="{{static_}}/images/ajax_indicator.gif" alt="AJAX Indicator"/>
                      </span>
                    </td>
                  </tr>
                </tbody>
              </table>
            </form><!--/#edit_basic_info_form-->
            
            <form id="upload_poster_form"
                  class="small form hidden"
                  action="{{webapp_}}/movie/{{movie.key.id}}/poster/"
                  method="POST"
                  enctype="multipart/form-data">
              <table>
                <tbody>
                  <tr>
                    <th style="width:1%;"><span class="nowrap">Upload a poster :</span></th>
                    <td><input type="file" name="poster" size="20"/></td>
                  </tr>
                  <tr>
                    <th style="width:1%;"></th>
                    <td>
                      {% if movie.has_poster %}
                        <div>
                          <input type="checkbox" name="delete" value="true"/>
                          Delete the poster.
                        </div>
                      {% else %}
                        <input type="hidden" name="delete"/>
                      {% endif %}
                      <input class="button" type="submit" value="Upload"/>
                      <input class="button" type="button" onclick="toggleBox('#overview');" value="Cancel"/>
                    </td>
                  </tr>
                </tbody>
              </table>
            </form><!--/#upload_poster_form-->
          
          </div><!--/.tab_panels-->
        
        </div><!--/.edit-->
      
      {% endif %}{# is_admin_ #}
    
    </div><!--/.information-->
    
    <!-- clear __________________________________________________________________________________-->
    
    <div class="clear"></div>
  
  </div><!--/.container-->
  
</div><!--/#overview-->







